﻿<%@ Page Title="My Account" Language="C#" MasterPageFile="~/ProductMaster.master"
    AutoEventWireup="true" CodeBehind="MyAccount.aspx.cs" Inherits="ShopOnline.MyAccount"
    Theme="ShopOnline" %>

<%@ Register Assembly="ShopOnline" Namespace="ShopOnline.Controls" TagPrefix="cc" %>
<%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cc" %>
<%@ Register Src="~/Controls/Common/DataPagerCtrl.ascx" TagName="DataPager" TagPrefix="uc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <link href="css/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
    <link href="css/smart_wizard.css" rel="stylesheet" type="text/css" />
    <link href="css/BusinessCard.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(function () {
            $("#tabs").tabs();
        });

        function gridOrder_OnClientRowClick(row, dataItem) {
            $('#<%= hidOrderID.ClientID %>').val(dataItem);
            $('#<%= btnSelectOrder.ClientID %>').click();
        }

        function selectOrder(dataItem) {
            grid<%= gridOrder.ClientID %>.selectRow(dataItem);
        }
    </script>
    <div class='form-register' style='margin-bottom: 20px'>
        <asp:Label ID="lblWelcome" runat="server">
           You can manage your account information, change password...
        </asp:Label>
    </div>
    <div id="tabs">
        <ul>
            <li><a href="#tabs-1">Update Information</a></li>
            <li><a href="#tabs-2">Change Password</a></li>
            <li><a href="#tabs-3">My Submitted Orders</a></li>
            <li runat="server" id="liBal"><a href="#<%= divBal.ClientID %>">Balance</a></li>
        </ul>
        <div class='form-register' id="tabs-1">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <table cellpadding="5" style='margin: auto' cellspacing="5">
                        <tr>
                            <td>
                                Name
                                <label class='required'>
                                    *</label>
                            </td>
                            <td>
                                <asp:TextBox ID='txtName' runat="server" class='tb7'></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Save" ID="require1" runat="server" ControlToValidate="txtName"
                                    Display="Dynamic" CssClass="requiredField" ErrorMessage="" Text=""></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Email
                                <label class='required'>
                                    *</label>
                            </td>
                            <td>
                                <asp:TextBox ID='txtEmail' runat="server" class='tb7'></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Save" ID="RequiredFieldValidator1" runat="server"
                                    ControlToValidate="txtEmail" Display="Dynamic" CssClass="requiredField" ErrorMessage=""
                                    Text=""></asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator Display="Dynamic" CssClass="requiredField" ID="regexEmailValid"
                                    runat="server" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                    ControlToValidate="txtEmail" ErrorMessage="<br/>Invalid Email Format"></asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Phone(Tel.)
                            </td>
                            <td>
                                <asp:TextBox ID='txtPhone' runat="server" class='tb7'></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Address
                            </td>
                            <td>
                                <asp:TextBox ID='txtAddress' runat="server" class='tb7'></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <button id="btnRegister" type="button" runat="server" onserverclick="btnRegister_OnClick"
                                    validationgroup="Save" class="button btn-cart">
                                    <span><span>Update</span></span></button>
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        <div class='form-register' id="tabs-2">
            <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <table cellpadding="5" style='margin: auto' cellspacing="5">
                        <tr>
                            <td>
                                Current Password
                                <label class='required'>
                                    *</label>
                            </td>
                            <td>
                                <asp:TextBox ID='txtCurrentPassword' TextMode="Password" runat="server" class='tb7'></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Change" ID="RequiredFieldValidator4"
                                    runat="server" class='requiredField' ErrorMessage="" Text='' Display="Dynamic"
                                    ControlToValidate="txtCurrentPassword"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                New Password
                                <label class='required'>
                                    *</label>
                            </td>
                            <td>
                                <asp:TextBox ID='txtNewPassword' TextMode="Password" runat="server" class='tb7'></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Change" ID="RequiredFieldValidator3"
                                    runat="server" class='requiredField' ErrorMessage="" Text='' Display="Dynamic"
                                    ControlToValidate="txtNewPassword"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Retype Password
                                <label class='required'>
                                    *</label>
                            </td>
                            <td>
                                <asp:TextBox ID='txtRetypeNewPassword' TextMode="Password" runat="server" class='tb7'></asp:TextBox>
                                <asp:CompareValidator ID="CompareValidator2" runat="server" ErrorMessage="<br/>Password not matched. Please retype."
                                    Display="Dynamic" class='requiredField' ControlToCompare="txtNewPassword" ControlToValidate="txtRetypeNewPassword"
                                    ValidationGroup="Change"></asp:CompareValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <button id="btnChangePassword" type="button" runat="server" onserverclick="btnChangePassword_OnClick"
                                    validationgroup="Change" class="button btn-cart">
                                    <span><span>Change Password</span></span></button>
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        <div class='form-register' id="tabs-3">
            <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <cc:CustomGrid Width="100%" AllowRowSelect="true" PagerStyle-Visible="false" OnClientRowClick="gridOrder_OnClientRowClick"
                        GridLines="None" CssClass="clientGrid" ID="gridOrder" runat="server" AutoGenerateColumns="false"
                        DataKeyField="ID" OnNeedDataSource="gridOrder_OnNeedDataSource" AllowPaging="true"
                        AllowCustomPaging="true">
                        <Columns>
                            <cc:CustomTemplateField UniqueName="OrderNo" HeaderText="OrderNo" ItemStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <%#  Eval("OrderNo")%>
                                </ItemTemplate>
                            </cc:CustomTemplateField>
                            <cc:CustomTemplateField UniqueName="ShipAddress" HeaderText="Ship To" ItemStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <%#  Eval("ShipAddress")%>
                                </ItemTemplate>
                            </cc:CustomTemplateField>
                            <cc:CustomTemplateField UniqueName="ShipDate" HeaderText="Shipping Date" ItemStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <%# Eval("ShipDate") != DBNull.Value ? ((DateTime)Eval("ShipDate")).ToString(POSSystem.BLL.SystemVariables.SysVars.DateFormat) : ""%>
                                </ItemTemplate>
                            </cc:CustomTemplateField>
                            <cc:CustomTemplateField UniqueName="TotalAmount" HeaderText="Total Amt" ItemStyle-HorizontalAlign="Right"
                                HeaderStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <%# string.Format("{0:C}", Eval("TotalAmount"))%>
                                </ItemTemplate>
                            </cc:CustomTemplateField>
                            <cc:CustomTemplateField UniqueName="GST" HeaderText="GST" ItemStyle-HorizontalAlign="Right"
                                HeaderStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <%# string.Format("{0:C}", Eval("GST"))%>
                                </ItemTemplate>
                            </cc:CustomTemplateField>
                            <cc:CustomTemplateField UniqueName="Status" HeaderText="Status" ItemStyle-HorizontalAlign="Left"
                                HeaderStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <%# Eval("StatusName") %>
                                </ItemTemplate>
                            </cc:CustomTemplateField>
                        </Columns>
                    </cc:CustomGrid>
                    <div style='height: 5px;'>
                        &nbsp;</div>
                    <uc:DataPager PageSize="5" ID="dataPagerDown" runat="server" OnPageIndexChanged="dataPager_OnPageIndexChanged" />
                </ContentTemplate>
            </asp:UpdatePanel>
            <div style='height: 15px;'>
                &nbsp;</div>
            <asp:UpdatePanel ID="updateItems" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <cc:CustomGrid Width="100%" AllowRowSelect="false" GridLines="None" CssClass="clientGrid"
                        ID="gridOrderItems" runat="server" AutoGenerateColumns="false" DataKeyField="ID"
                        OnNeedDataSource="gridOrderItems_OnNeedDataSource" AllowPaging="false">
                        <Columns>
                            <cc:CustomTemplateField UniqueName="ProductName" HeaderText="Item" ItemStyle-HorizontalAlign="Left"
                                ItemStyle-Width="50%" HeaderStyle-Width="50%">
                                <ItemTemplate>
                                    <a onclick='<%# Eval("ProductImage") != DBNull.Value ? "openWindow(\"SlideShow.aspx?unique=1&id=" + Eval("ProductImage").ToString() + "\"); return false;" : "" %>'
                                        style='cursor: pointer;'>
                                        <img runat="server" title='Click to view full image.' style='border: 0px none white; vertical-align: middle'
                                            src='<%# Eval("ThumbUrl") != DBNull.Value && Eval("ThumbUrl") != "" ? ShopOnline.Utilities.GetImageUrl(Eval("ThumbUrl").ToString()) : GetDefaultPic() %>' height='24' />
                                    </a>
                                    <a id="A1" class='product-name' style='color: #ff339c' href='<%# (int)Eval("Category") == 2 ? string.Format("~/BusinessCard.aspx?id={0}", Eval("ProductID").ToString()) : string.Format("~/ProductDetails.aspx?{0}=", ShopOnline.BasePage.PRD) + string.Format("{0}_{1}", ShopOnline.Utilities.GetValidParam(Eval("ProductName").ToString()), Eval("ProductID").ToString())  %>'
                                        runat="server">
                                        <asp:Label ID="lblProductName" runat="server" Text='<%# Eval("ProductName") %>'></asp:Label>
                                    </a>
                                </ItemTemplate>
                            </cc:CustomTemplateField>
                            <cc:CustomTemplateField UniqueName="Quantity" HeaderText="Quantity" ItemStyle-HorizontalAlign="Right"
                                HeaderStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <%#  Eval("Quantity")%>
                                </ItemTemplate>
                            </cc:CustomTemplateField>
                            <cc:CustomTemplateField UniqueName="CustomerPrice" HeaderText="Price" ItemStyle-HorizontalAlign="Right"
                                HeaderStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <%# string.Format("{0:C}", Eval("CustomerPrice"))%>
                                </ItemTemplate>
                            </cc:CustomTemplateField>
                            <cc:CustomTemplateField UniqueName="TotalAmount" HeaderText="Total Amt" ItemStyle-HorizontalAlign="Right"
                                HeaderStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <%# string.Format("{0:C}", Eval("TotalAmount"))%>
                                </ItemTemplate>
                            </cc:CustomTemplateField>
                            <cc:CustomTemplateField UniqueName="GST" HeaderText="GST" ItemStyle-HorizontalAlign="Right"
                                HeaderStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <%# string.Format("{0:C}", Eval("GST"))%>
                                </ItemTemplate>
                            </cc:CustomTemplateField>
                        </Columns>
                    </cc:CustomGrid>
                    <asp:HiddenField ID="hidOrderID" runat="server" />
                    <asp:Button ID="btnSelectOrder" runat="server" OnClick="btnSelectOrder_OnClick" Style='display: none' />
                </ContentTemplate>
            </asp:UpdatePanel>

            <div class="notice-msg">Click on an order to view details</div><br />
        </div>
        <div class='form-register' id="divBal" runat="server">
            <table border="0" cellpadding="0" cellspacing="0" class='clientGrid' width="100%">
                <tr class='gridHeader gridRowEven'>
                    <td align="left" style="border-left-style:none !important">
                        Total Amount
                    </td>
                    <td align="left" style="border-left-style:none !important">
                        Paid Amount
                    </td>
                    <td align="left" style="border-left-style:none !important">
                        Balance
                    </td>
                </tr>
                <tr class='gridRow gridRowOdd'>
                    <td align="right">
                        <asp:Label ID="lblTotalAmount" runat="server"></asp:Label>
                    </td>
                    <td align="right">
                        <asp:Label ID="lblPaidAmount" runat="server"></asp:Label>
                    </td>
                    <td align="right">
                        <asp:Label ID="lblBalance" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr class='gridRow gridRowEven'>
                    <td colspan="3" align="right">
                        Bank: Commonwealth Bank<br />
                        BSB: 062 948<br />
                        Account: 10287847
                    </td>
                </tr>
            </table>


        </div>
    </div>
</asp:Content>
